<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib prefix="his_fns" uri="/WEB-INF/tlds/his_fns.tld" %>
<script type="text/javascript">
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
            btsubmit();
        	return false;
        }
        function btsubmit() {
            var form=$("#searchForm");
            if($("#batch").is(':checked')){
                form.attr("onsubmit","return loadDivForm('mainCenterDiv','searchForm','${ctx}/drug/drugStock/queryBat');")
            }else{
                form.attr("onsubmit","return loadDivForm('mainCenterDiv','searchForm','${ctx}/drug/drugStock/query');")
            }
            form.submit();
        }
</script>
    <div class="content-wrap">
        <div class="wrapper" style="bottom: 50px;">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#"   onclick="loadDiv('mainCenterDiv','${ctx}/drug/drugStock/drugStockQuery')">库存量列表</a>
                </li>
            </ul>
            <section class="panel panel-default">
                <div class="panel-body">
                    <div class="table-responsive no-border">
                        <div class="datatable-top">
                            <div class="pull-left">
                            	<form:form id="searchForm" modelAttribute="drugStock"  onsubmit="" method="post" class="form-inline">
                                    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                                    <label >药品类别:</label>
                                    <sys:treeselect selectedParent="true" id="drugType" name="drugType" value="${drugStock.drugType}"
                                                    update="${not empty drugType}" labelName="drugType1"
                                                    labelValue="${drugStock.drugNameDict.drugClassDict.className}"
                                                    title="药品类别"
                                                    url="/drug/drugClassDict/treeData" extId="${drugStock.id}" cssClass="form-control"/>
                                    <label>药品名称：</label><form:input path="drugName" htmlEscape="false" maxlength="50" class="form-control" />
                                    <%--<label>合并批号：</label><form:checkbox path="batch" id="batch" htmlEscape="false"></form:checkbox>--%>
                                    <%--<label>库存单位：</label><form:select path="storageId" name="storageId" htmlEscape="false" maxlength="50" class="form-control" >--%>
                                    <%--<form:option value=""></form:option>--%>
                                    <%--<form:option value=""></form:option>--%>
                                    <%--<c:forEach items="${list}" var="drugStorageDept">--%>
                                        <%--<form:option value="${drugStorageDept.id}">${drugStorageDept.storageName}</form:option>--%>
                                    <%--</c:forEach>--%>
                                <%--</form:select>--%>
                                    <label>库存量显示为0： </label><form:checkbox path="batch" id="batch" htmlEscape="false"></form:checkbox>
                                    <input id="btnSubmit" class="btn btn-primary" type="button" value="查询" onclick="btsubmit()"/>
                                </form:form>
                            </div>
                        </div>
                        <table id="contentTable" class="table table-bordered table-striped mg-t datatable">
                            <thead>
                                <tr>
                                        <%--<th>药品代码</th>--%>
                                        <th>药品名称</th>
                                        <th hidden>库存单位</th>
                                        <%--<th>规格</th>--%>
                                        <%--<th>单位</th>--%>
                                        <%--<th>包装数量</th>--%>
                                        <th>包装规格</th>
                                        <th>包装单位</th>
                                        <th>厂家</th>
                                        <th id="batchNo">批号</th>
                                        <th id="expireDate">有效期</th>
                                        <th>大包装库存量</th>
                                </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${page.list}" var="drugStock">
                                <tr>
                                        <%--<td> ${drugStock.drugCode}</td>--%>
                                        <td> ${drugStock.drugName}</td>
                                        <td hidden> ${drugStock.storageId}</td>
                                        <%--<td> ${drugStock.minSpec}</td>--%>
                                        <%--<td> ${fns:getDictLabel(drugStock.minUnits,'SPEC_UNIT','')}</td>--%>
                                        <%--<td> ${drugStock.packageNum}</td>--%>
                                        <td> ${drugStock.packageSpec}</td>
                                        <td> ${fns:getDictLabel(drugStock.packageUnits,'SPEC_UNIT','')}</td>
                                        <td> ${drugStock.firmName}</td>
                                        <td id="batchNo1"> ${drugStock.batchNo}</td>
                                        <td id="expireDate1"> <fmt:formatDate value="${drugStock.expireDate}" pattern="yyyy-MM-dd"/></td>
                                        <td> ${drugStock.quantity/drugStock.packageNum}</td>
                                </tr>
                            </c:forEach>

                        </table>
                        <div class="pagination">${page}</div>
                    </div>
                </div>
            </section>
        </div>
    </div>